﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:local="clr-namespace:EIA.SLClient.PlatManage.PMMgr"
	xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
	mc:Ignorable="d"
	x:Class="EIA.SLClient.PlatManage.PMMgr.SR_RoleListView"
	d:DesignWidth="260" d:DesignHeight="480">
	<UserControl.Resources>
		<local:SR_RoleListViewModel x:Key="SR_RoleListViewModelDataSource" />
		<DataTemplate x:Key="RoleDataTemplate">
			<Grid d:DesignWidth="120">
				<CheckBox Content="{Binding Item1.RoleName}" IsChecked="{Binding Item2.IsChecked, Mode=TwoWay}" Margin="8" Foreground="#FFA7E4DD" VerticalAlignment="Center" FontSize="12"/>
			</Grid>
		</DataTemplate>
		<Style x:Key="ListBoxItemStyle1" TargetType="ListBoxItem">
			<Setter Property="Padding" Value="3"/>
			<Setter Property="HorizontalContentAlignment" Value="Left"/>
			<Setter Property="VerticalContentAlignment" Value="Top"/>
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="TabNavigation" Value="Local"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBoxItem">
						<Grid Background="{TemplateBinding Background}">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="MouseOver">
										<Storyboard>
											<DoubleAnimation Duration="0" To=".35" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="fillColor"/>
										</Storyboard>
									</VisualState>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<DoubleAnimation Duration="0" To=".55" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="contentPresenter"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="SelectionStates">
									<VisualState x:Name="Unselected"/>
									<VisualState x:Name="Selected">
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="FocusStates">
									<VisualState x:Name="Focused">
									</VisualState>
									<VisualState x:Name="Unfocused"/>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Rectangle x:Name="fillColor" Fill="#FFBADDE9" IsHitTestVisible="False" Opacity="0" RadiusY="1" RadiusX="1"/>
							<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}"/>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</UserControl.Resources>
	<UserControl.FontSize>
		<StaticResource ResourceKey="FontSize"/>
	</UserControl.FontSize>
	<UserControl.FontFamily>
		<StaticResource ResourceKey="FontFamily"/>
	</UserControl.FontFamily>

	<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource SR_RoleListViewModelDataSource}}" Background="White">
		<i:Interaction.Triggers>
			<i:EventTrigger>
				<ei:CallMethodAction MethodName="OnLoad" TargetObject="{Binding Mode=OneWay}"/>
			</i:EventTrigger>
		</i:Interaction.Triggers>
		<Grid>
			<Grid.RowDefinitions>
				<RowDefinition Height="26"/>
				<RowDefinition/>
				<RowDefinition Height="26"/>
			</Grid.RowDefinitions>
			<local:SR_StaffNamesView Staffs="{Binding SelectedStaffs}"/>
			<ListBox ItemsSource="{Binding RoleCollection}" ItemTemplate="{StaticResource RoleDataTemplate}" HorizontalContentAlignment="Stretch" Padding="8,0,8,8" BorderThickness="0" ItemContainerStyle="{StaticResource ListBoxItemStyle1}" Grid.Row="1"/>
			<Grid Grid.Row="2" Background="#FFE1E1E1">
				<HyperlinkButton Content="重置" HorizontalAlignment="Left" Margin="16,0,0,0" Command="{Binding RetrieveItemsCommand}" Grid.Row="2" VerticalAlignment="Center"/>
				<HyperlinkButton Content="保存" HorizontalAlignment="Right" Margin="0,0,16,0" Command="{Binding SaveCommand}" Grid.Row="2" VerticalAlignment="Center"/>
			</Grid>
		</Grid>
	</Grid>
</UserControl>
